﻿//using Leadshine;
using System;
using System.Runtime.InteropServices;

namespace MotionIoLib
{
   


    public class IoCtrl_LTDMC : IoCtrl
    {
        private ushort _ConnecNo = 0;

        public IoCtrl_LTDMC(int nIndex, ulong nCardNo)
            : base(nIndex, nCardNo)
        {
        }

        public override void DeInit()
        {
        }

        public override bool Init()
        {
            m_bOpen = false;
            _ConnecNo = (ushort)m_nCardNo;
            //short res = LTDMC.smc_board_init((ushort)_ConnecNo, 2, $"192.168.5.{m_nCardNo}", 115200);//连接控制器
            //if (res != 0)
            //{
            //    return false;
            //}
            m_bOpen = true;
            return true;
        }

        public override bool InStopDisenable(int nIndex)
        {
            throw new NotImplementedException();
        }

        public override bool InStopEnable(int nIndex)
        {
            throw new NotImplementedException();
        }

        public override bool ReadIOIn(ref int nData)
        {
            nData = (int)LTDMC.dmc_read_inport(_ConnecNo, 0);
            return true;
        }

        public override bool ReadIoInBit(int nIndex)
        {
            //输入口
            short n = LTDMC.dmc_read_inbit(_ConnecNo, (ushort)nIndex);
            return n == 0;
        }

        public override bool ReadIOOut(ref int nData)
        {
            throw new NotImplementedException();
        }

        public override bool ReadIoOutBit(int nIndex)
        {
            //输入口
            short n = LTDMC.dmc_read_outbit(_ConnecNo, (ushort)nIndex);
            return n == 0;
        }

        public override bool WriteIo(int nData)
        {
            throw new NotImplementedException();
        }

        public override bool WriteIoBit(int nIndex, bool bBit)
        {
            int nAxisIndex = (nIndex & 0xff00) >> 8;
            int nBitIndex = nIndex & 0x00ff;


             short ret = LTDMC.dmc_write_outbit(_ConnecNo, (ushort)nBitIndex, bBit ? (ushort)0 : (ushort)1);
            return true;
        }
    }

   
    public class LTDMC
    {        //配置CAN DA模式（适用于所有脉冲卡）
        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_da_mode(ushort CardNo, ushort NoteID, ushort channel, ushort mode, uint buffer_nums);
        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_da_mode(ushort CardNo, ushort NoteID, ushort channel, ref ushort mode, uint buffer_nums);
        //CAN参数写入flash（适用于所有脉冲卡）
        [DllImport("LTDMC.dll")]
        public static extern short nmc_write_to_flash(ushort CardNo, ushort PortNum, ushort NodeNum);
        //CAN总线链接（适用于所有脉冲卡）
        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_connect_state(UInt16 CardNo, UInt16 NodeNum, UInt16 state, UInt16 baud);
        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_connect_state(UInt16 CardNo, ref UInt16 NodeNum, ref UInt16 state);
        //---------------------------CAN ADDA带返回值检测----------------------
        //设置CAN DA参数（适用于DMC3000/5X10系列脉冲卡）
        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_da_output_ex(ushort CardNo, ushort NoteID, ushort channel, double Value, ref ushort state);
        //读取CAN DA参数（适用于DMC3000/5X10系列脉冲卡）
        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_da_output_ex(ushort CardNo, ushort NoteID, ushort channel, ref double Value, ref ushort state);
        //读取CAN AD参数（适用于DMC3000/5X10系列脉冲卡）
        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_ad_input_ex(ushort CardNo, ushort NoteID, ushort channel, ref double Value, ref ushort state);
        //配置CAN AD模式（适用于DMC3000/5X10系列脉冲卡）
        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_ad_mode_ex(ushort CardNo, ushort NoteID, ushort channel, ushort mode, UInt32 buffer_nums, ref ushort state);
        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_ad_mode_ex(ushort CardNo, ushort NoteID, ushort channel, ref ushort mode, UInt32 buffer_nums, ref ushort state);
        //配置CAN DA模式（适用于DMC3000/5X10系列脉冲卡）
        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_da_mode_ex(ushort CardNo, ushort NoteID, ushort channel, ushort mode, UInt32 buffer_nums, ref ushort state);
        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_da_mode_ex(ushort CardNo, ushort NoteID, ushort channel, ref ushort mode, UInt32 buffer_nums, ref ushort state);
        //参数写入flash（适用于DMC3000/5X10系列脉冲卡）
        [DllImport("LTDMC.dll")]
        public static extern short nmc_write_to_flash_ex(ushort CardNo, ushort PortNum, ushort NodeNum, ref ushort state);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_perline_time(ushort CardNo, ushort TypeIndex, ref uint Averagetime, ref uint Maxtime, ref ulong Cycles);
        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_slave_output_retain(ushort CardNo, ushort Enable);
        [DllImport("LTDMC.dll")]
        public static extern short dmc_set_profile_acc(ushort CardNo, ushort axis, double Min_Vel, double Max_Vel, double Tacc, double Tdec, double stop_vel);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_profile_acc(ushort CardNo, ushort axis, ref double Min_Vel, ref double Max_Vel, ref double Tacc, ref double Tdec, ref double stop_vel);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_set_profile_unit_acc(ushort CardNo, ushort axis, double Min_Vel, double Max_Vel, double Tacc, double Tdec, double stop_vel);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_profile_unit_acc(ushort CardNo, ushort axis, ref double Min_Vel, ref double Max_Vel, ref double Tacc, ref double Tdec, ref double stop_vel);

        [DllImport("LTDMC.dll")]
        public static extern short dmc8801_board_init();

        [DllImport("LTDMC.dll")]
        public static extern short dmc_original_reset(ushort CardNo);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_set_safety_param(ushort CardNo, ushort axis, ushort enable, int safety_pos);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_safety_param(ushort CardNo, ushort axis, ref ushort enable, ref int safety_pos);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_cmdcycletime(ushort CardNo, ushort PortNum, ref uint cmdtime);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_cycletime(ushort CardNo, ushort PortNum, ref uint CycleTime);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_cmdcycletime(ushort CardNo, ushort PortNum, uint cmdtime);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_cycletime(ushort CardNo, ushort PortNum, uint CycleTime);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_start_log(ushort CardNo, ushort chan, ushort node, ushort Ifenable);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_log(ushort CardNo, ushort chan, ushort node, uint[] data);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_config_atuo_log(ushort CardNo, ushort ifenable, ushort dir, ushort byte_index, ushort mask, ushort condition, ushort counter);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_log_state(ushort CardNo, ushort chan, ref uint state);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_board_init();

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_board_reset();

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_board_close();

        [DllImport("LTDMC.dll")]
        public static extern short dmc_soft_reset(ushort CardNo);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_cool_reset(ushort CardNo);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_CardInfList(ref ushort CardNum, uint[] CardTypeList, ushort[] CardIdList);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_card_version(ushort CardNo, ref uint CardVersion);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_card_soft_version(ushort CardNo, ref uint FirmID, ref uint SubFirmID);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_card_lib_version(ref uint LibVer);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_release_version(ushort ConnectNo, byte[] ReleaseVersion);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_total_axes(ushort CardNo, ref uint TotalAxis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_total_ionum(ushort CardNo, ref ushort TotalIn, ref ushort TotalOut);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_AxisIoMap(ushort CardNo, ushort Axis, ushort IoType, ushort MapIoType, ushort MapIoIndex, uint Filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_AxisIoMap(ushort CardNo, ushort Axis, ushort IoType, ref ushort MapIoType, ref ushort MapIoIndex, ref uint Filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_axis_io_map(ushort CardNo, ushort Axis, ushort IoType, ushort MapIoType, ushort MapIoIndex, double Filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_axis_io_map(ushort CardNo, ushort Axis, ushort IoType, ref ushort MapIoType, ref ushort MapIoIndex, ref double Filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_special_input_filter(ushort CardNo, double Filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_io_map_virtual(ushort CardNo, ushort bitno, ushort MapIoType, ushort MapIoIndex, double Filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_io_map_virtual(ushort CardNo, ushort bitno, ref ushort MapIoType, ref ushort MapIoIndex, ref double Filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_inbit_virtual(ushort CardNo, ushort bitno);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_download_configfile(ushort CardNo, string FileName);
        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_download_configfile_ex(ushort CardNo, string FileName);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_download_firmware(ushort CardNo, string FileName);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_softlimit(ushort CardNo, ushort axis, ushort enable, ushort source_sel, ushort SL_action, int N_limit, int P_limit);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_softlimit(ushort CardNo, ushort axis, ref ushort enable, ref ushort source_sel, ref ushort SL_action, ref int N_limit, ref int P_limit);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_el_mode(ushort CardNo, ushort axis, ushort el_enable, ushort el_logic, ushort el_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_el_mode(ushort CardNo, ushort axis, ref ushort el_enable, ref ushort el_logic, ref ushort el_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_emg_mode(ushort CardNo, ushort axis, ushort enable, ushort emg_logic);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_emg_mode(ushort CardNo, ushort axis, ref ushort enbale, ref ushort emg_logic);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_dstp_mode(ushort CardNo, ushort axis, ushort enable, ushort logic, uint time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_dstp_mode(ushort CardNo, ushort axis, ref ushort enable, ref ushort logic, ref uint time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_dstp_time(ushort CardNo, ushort axis, uint time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_dstp_time(ushort CardNo, ushort axis, ref uint time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_io_dstp_mode(ushort CardNo, ushort axis, ushort enable, ushort logic);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_io_dstp_mode(ushort CardNo, ushort axis, ref ushort enable, ref ushort logic);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_dec_stop_time(ushort CardNo, ushort axis, double stop_time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_dec_stop_time(ushort CardNo, ushort axis, ref double stop_time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_profile(ushort CardNo, ushort axis, double Min_Vel, double Max_Vel, double Tacc, double Tdec, double stop_vel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_profile(ushort CardNo, ushort axis, ref double Min_Vel, ref double Max_Vel, ref double Tacc, ref double Tdec, ref double stop_vel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_s_profile(ushort CardNo, ushort axis, ushort s_mode, double s_para);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_s_profile(ushort CardNo, ushort axis, ushort s_mode, ref double s_para);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_vector_profile_multicoor(ushort CardNo, ushort Crd, double Min_Vel, double Max_Vel, double Tacc, double Tdec, double Stop_Vel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_vector_profile_multicoor(ushort CardNo, ushort Crd, ref double Min_Vel, ref double Max_Vel, ref double Taccdec, ref double Tdec, ref double Stop_Vel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_pulse_outmode(ushort CardNo, ushort axis, ushort outmode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_pulse_outmode(ushort CardNo, ushort axis, ref ushort outmode);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_set_gear_follow_profile(ushort CardNo, ushort axis, ushort enable, ushort master_axis, double ratio);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_gear_follow_profile(ushort CardNo, ushort axis, ref ushort enable, ref ushort master_axis, ref double ratio);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_set_grant_error_protect(ushort CardNo, ushort axis, ushort enable, uint dstp_error, uint emg_error);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_grant_error_protect(ushort CardNo, ushort axis, ref ushort enable, ref uint dstp_error, ref uint emg_error);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_pmove(ushort CardNo, ushort axis, int Dist, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_reset_target_position(ushort CardNo, ushort axis, int dist, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_change_speed(ushort CardNo, ushort axis, double Curr_Vel, double Taccdec);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_update_target_position(ushort CardNo, ushort axis, int dist, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_PvtTable(ushort CardNo, ushort iaxis, uint count, double[] pTime, int[] pPos, double[] pVel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_PtsTable(ushort CardNo, ushort iaxis, uint count, double[] pTime, int[] pPos, double[] pPercent);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_PvtsTable(ushort CardNo, ushort iaxis, uint count, double[] pTime, int[] pPos, double velBegin, double velEnd);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_PttTable(ushort CardNo, ushort iaxis, uint count, double[] pTime, int[] pPos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_PvtMove(ushort CardNo, ushort AxisNum, ushort[] AxisList);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_vmove(ushort CardNo, ushort axis, ushort dir);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_line_multicoor(ushort CardNo, ushort crd, ushort axisNum, ushort[] axisList, int[] DistList, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_arc_move_multicoor(ushort CardNo, ushort crd, ushort[] AxisList, int[] Target_Pos, int[] Cen_Pos, ushort Arc_Dir, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_home_pin_logic(ushort CardNo, ushort axis, ushort org_logic, double filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_home_pin_logic(ushort CardNo, ushort axis, ref ushort org_logic, ref double filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_homemode(ushort CardNo, ushort axis, ushort home_dir, double vel, ushort mode, ushort EZ_count);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_home_position_unit(ushort ConnectNo, ushort axis, ushort enable, double position);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_homemode(ushort CardNo, ushort axis, ref ushort home_dir, ref double vel, ref ushort home_mode, ref ushort EZ_count);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_home_move(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_set_home_profile_unit(ushort CardNo, ushort axis, double Low_Vel, double High_Vel, double Tacc, double Tdec);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_home_profile_unit(ushort CardNo, ushort axis, ref double Low_Vel, ref double High_Vel, ref double Tacc, ref double Tdec);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_home_result(ushort CardNo, ushort axis, ref ushort state);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_sd_mode(ushort CardNo, ushort axis, ushort sd_logic, ushort sd_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_sd_mode(ushort CardNo, ushort axis, ref ushort sd_logic, ref ushort sd_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_homelatch_mode(ushort CardNo, ushort axis, ushort enable, ushort logic, ushort source);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_homelatch_mode(ushort CardNo, ushort axis, ref ushort enable, ref ushort logic, ref ushort source);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_homelatch_flag(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_reset_homelatch_flag(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int dmc_get_homelatch_value(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_handwheel_channel(ushort CardNo, ushort index);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_handwheel_channel(ushort CardNo, ref ushort index);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_handwheel_inmode(ushort CardNo, ushort axis, ushort inmode, int multi, double vh);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_handwheel_inmode(ushort CardNo, ushort axis, ref ushort inmode, ref int multi, ref double vh);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_handwheel_inmode_extern(ushort CardNo, ushort inmode, ushort AxisNum, ushort[] AxisList, int[] multi);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_handwheel_inmode_extern(ushort CardNo, ref ushort inmode, ref ushort AxisNum, ushort[] AxisList, int[] multi);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_handwheel_move(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_set_handwheel_encoder(ushort CardNo, ushort channel, int pos);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_handwheel_encoder(ushort CardNo, ushort channel, ref int pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_counter_inmode(ushort CardNo, ushort axis, ushort mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_counter_inmode(ushort CardNo, ushort axis, ref ushort mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int dmc_get_encoder(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_encoder(ushort CardNo, ushort axis, int encoder_value);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_ez_mode(ushort CardNo, ushort axis, ushort ez_logic, ushort ez_mode, double filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_ez_mode(ushort CardNo, ushort axis, ref ushort ez_logic, ref ushort ez_mode, ref double filter);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_set_extra_encoder_mode(ushort CardNo, ushort channel, ushort inmode, ushort multi);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_extra_encoder_mode(ushort CardNo, ushort channel, ref ushort inmode, ref ushort multi);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_set_extra_encoder(ushort CardNo, ushort channel, int pos);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_extra_encoder(ushort CardNo, ushort channel, ref int pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_ltc_mode(ushort CardNo, ushort axis, ushort ltc_logic, ushort ltc_mode, double filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_ltc_mode(ushort CardNo, ushort axis, ref ushort ltc_logic, ref ushort ltc_mode, ref double filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_latch_mode(ushort CardNo, ushort axis, ushort all_enable, ushort latch_source, ushort triger_chunnel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_latch_mode(ushort CardNo, ushort axis, ref ushort all_enable, ref ushort latch_source, ref ushort triger_chunnel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int dmc_get_latch_value(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_latch_flag(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_reset_latch_flag(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int dmc_get_latch_value_extern(ushort CardNo, ushort axis, ushort Index);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_latch_flag_extern(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_SetLtcOutMode(ushort CardNo, ushort axis, ushort enable, ushort bitno);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_GetLtcOutMode(ushort CardNo, ushort axis, ref ushort enable, ref ushort bitno);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_latch_stop_time(ushort CardNo, ushort axis, int time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_latch_stop_time(ushort CardNo, ushort axis, ref int time);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_ltc_set_mode(ushort CardNo, ushort latch, ushort ltc_mode, ushort ltc_logic, double filter);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_ltc_get_mode(ushort CardNo, ushort latch, ref ushort ltc_mode, ref ushort ltc_logic, ref double filter);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_ltc_set_source(ushort CardNo, ushort latch, ushort axis, ushort ltc_source);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_ltc_get_source(ushort CardNo, ushort latch, ushort axis, ref ushort ltc_source);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_ltc_reset(ushort CardNo, ushort latch);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_ltc_get_number(ushort CardNo, ushort latch, ushort axis, ref int number);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_ltc_get_value_unit(ushort CardNo, ushort latch, ushort axis, ref double value);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_softltc_set_mode(ushort ConnectNo, ushort latch, ushort ltc_enable, ushort ltc_mode, ushort ltc_inbit, ushort ltc_logic, double filter);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_softltc_get_mode(ushort ConnectNo, ushort latch, ref ushort ltc_enable, ref ushort ltc_mode, ref ushort ltc_inbit, ref ushort ltc_logic, ref double filter);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_softltc_set_source(ushort ConnectNo, ushort latch, ushort axis, ushort ltc_source);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_softltc_get_source(ushort ConnectNo, ushort latch, ushort axis, ref ushort ltc_source);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_softltc_reset(ushort ConnectNo, ushort latch);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_softltc_get_number(ushort ConnectNo, ushort latch, ushort axis, ref int number);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_softltc_get_value_unit(ushort ConnectNo, ushort latch, ushort axis, ref double value);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_set_config(ushort CardNo, ushort axis, ushort enable, ushort cmp_source);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_get_config(ushort CardNo, ushort axis, ref ushort enable, ref ushort cmp_source);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_clear_points(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_add_point(ushort CardNo, ushort axis, int pos, ushort dir, ushort action, uint actpara);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_get_current_point(ushort CardNo, ushort axis, ref int pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_get_points_runned(ushort CardNo, ushort axis, ref int pointNum);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_get_points_remained(ushort CardNo, ushort axis, ref int pointNum);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_compare_add_point_cycle(ushort CardNo, ushort cmp, int pos, ushort dir, uint bitno, uint cycle, ushort level);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_set_config_extern(ushort CardNo, ushort enable, ushort cmp_source);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_get_config_extern(ushort CardNo, ref ushort enable, ref ushort cmp_source);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_clear_points_extern(ushort CardNo);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_add_point_extern(ushort CardNo, ushort[] axis, int[] pos, ushort[] dir, ushort action, uint actpara);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_get_current_point_extern(ushort CardNo, int[] pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_get_points_runned_extern(ushort CardNo, ref int pointNum);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_compare_get_points_remained_extern(ushort CardNo, ref int pointNum);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_hcmp_set_mode(ushort CardNo, ushort hcmp, ushort cmp_enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_hcmp_get_mode(ushort CardNo, ushort hcmp, ref ushort cmp_enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_hcmp_set_config(ushort CardNo, ushort hcmp, ushort axis, ushort cmp_source, ushort cmp_logic, int time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_hcmp_get_config(ushort CardNo, ushort hcmp, ref ushort axis, ref ushort cmp_source, ref ushort cmp_logic, ref int time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_hcmp_add_point(ushort CardNo, ushort hcmp, int cmp_pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_hcmp_set_liner(ushort CardNo, ushort hcmp, int Increment, int Count);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_hcmp_get_liner(ushort CardNo, ushort hcmp, ref int Increment, ref int Count);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_hcmp_get_current_state(ushort CardNo, ushort hcmp, ref int remained_points, ref int current_point, ref int runned_points);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_hcmp_clear_points(ushort CardNo, ushort hcmp);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_cmp_pin(ushort CardNo, ushort hcmp);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_write_cmp_pin(ushort CardNo, ushort hcmp, ushort on_off);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_inbit(ushort CardNo, ushort bitno);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_write_outbit(ushort CardNo, ushort bitno, ushort on_off);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_outbit(ushort CardNo, ushort bitno);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern uint dmc_read_inport(ushort CardNo, ushort portno);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern uint dmc_read_outport(ushort CardNo, ushort portno);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_write_outport(ushort CardNo, ushort portno, uint outport_val);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_IO_TurnOutDelay(ushort CardNo, ushort bitno, uint DelayTime);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_SetIoCountMode(ushort CardNo, ushort bitno, ushort mode, uint filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_GetIoCountMode(ushort CardNo, ushort bitno, ref ushort mode, ref uint filter);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_SetIoCountValue(ushort CardNo, ushort bitno, uint CountValue);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_GetIoCountValue(ushort CardNo, ushort bitno, ref uint CountValue);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_reverse_outbit(ushort CardNo, ushort bitno, double reverse_time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_io_count_mode(ushort CardNo, ushort bitno, ushort mode, double filter_time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_io_count_mode(ushort CardNo, ushort bitno, ref ushort mode, ref double filter_time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_io_count_value(ushort CardNo, ushort bitno, uint CountValue);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_io_count_value(ushort CardNo, ushort bitno, ref uint CountValue);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_inp_mode(ushort CardNo, ushort axis, ushort enable, ushort inp_logic);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_inp_mode(ushort CardNo, ushort axis, ref ushort enable, ref ushort inp_logic);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_erc_mode(ushort CardNo, ushort axis, ushort enable, ushort erc_logic, ushort erc_width, ushort erc_off_time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_erc_mode(ushort CardNo, ushort axis, ref ushort enable, ref ushort erc_logic, ref ushort erc_width, ref ushort erc_off_time);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_alm_mode(ushort CardNo, ushort axis, ushort enable, ushort alm_logic, ushort alm_action);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_alm_mode(ushort CardNo, ushort axis, ref ushort enable, ref ushort alm_logic, ref ushort alm_action);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_write_sevon_pin(ushort CardNo, ushort axis, ushort on_off);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_sevon_pin(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_write_erc_pin(ushort CardNo, ushort axis, ushort sel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_erc_pin(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_rdy_pin(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_set_sevon_enable(ushort CardNo, ushort axis, ushort on_off);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_sevon_enable(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern double dmc_read_current_speed(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int dmc_get_position(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_position(ushort CardNo, ushort axis, int current_position);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int dmc_get_target_position(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_check_done(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_check_done_multicoor(ushort CardNo, ushort crd);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern uint dmc_axis_io_status(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_stop(ushort CardNo, ushort axis, ushort stop_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_stop_multicoor(ushort CardNo, ushort crd, ushort stop_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_emg_stop(ushort CardNo);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_factor_error(ushort CardNo, ushort axis, double factor, int error);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_factor_error(ushort CardNo, ushort axis, ref double factor, ref int error);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_check_success_pulse(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_check_success_encoder(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_LinkState(ushort CardNo, ref ushort State);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_can_state(ushort CardNo, ushort NodeNum, ushort state, ushort Baud);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_can_state(ushort CardNo, ref ushort NodeNum, ref ushort state);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_write_can_outbit(ushort CardNo, ushort Node, ushort bitno, ushort on_off);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_can_outbit(ushort CardNo, ushort Node, ushort bitno);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_can_inbit(ushort CardNo, ushort Node, ushort bitno);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_write_can_outport(ushort CardNo, ushort Node, ushort PortNo, uint outport_val);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern uint dmc_read_can_outport(ushort CardNo, ushort Node, ushort PortNo);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern uint dmc_read_can_inport(ushort CardNo, ushort Node, ushort PortNo);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_can_errcode(ushort CardNo, ref ushort Errcode);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_da_output(ushort CardNo, ushort NoteID, ushort channel, double Value);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_da_output(ushort CardNo, ushort NoteID, ushort channel, ref double Value);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_ad_input(ushort CardNo, ushort NoteID, ushort channel, ref double Value);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_ad_mode(ushort CardNo, ushort NoteID, ushort channel, ushort mode, uint buffer_nums);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_ad_mode(ushort CardNo, ushort NoteID, ushort channel, ref ushort mode, uint buffer_nums);


        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_write_sn(ushort CardNo, string new_sn);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_check_sn(ushort CardNo, string check_sn);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_debug_mode(ushort mode, string FileName);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_debug_mode(ref ushort mode, IntPtr FileName);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_axis_run_mode(ushort CardNo, ushort axis, ref ushort run_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_trace(ushort CardNo, ushort axis, ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_trace(ushort CardNo, ushort axis, ref ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_trace_data(ushort CardNo, ushort axis, ushort data_option, ref int ReceiveSize, double[] time, double[] data, ref int remain_num);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_equiv(ushort CardNo, ushort axis, ref double equiv);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_equiv(ushort CardNo, ushort axis, double equiv);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_backlash_unit(ushort CardNo, ushort axis, double backlash);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_backlash_unit(ushort CardNo, ushort axis, ref double backlash);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_position_unit(ushort CardNo, ushort axis, double pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_position_unit(ushort CardNo, ushort axis, ref double pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int dmc_get_target_position_unit(ushort ConnectNo, ushort axis, ref double pos);	//读取指定轴的目标位置



        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_encoder_unit(ushort CardNo, ushort axis, double pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_encoder_unit(ushort CardNo, ushort axis, ref double pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_pmove_unit(ushort CardNo, ushort axis, double Dist, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_t_pmove_unit(ushort CardNo, ushort axis, double Dist, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_ex_t_pmove_unit(ushort CardNo, ushort axis, double Dist, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_s_pmove_unit(ushort CardNo, ushort axis, double Dist, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_ex_s_pmove_unit(ushort CardNo, ushort axis, double Dist, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_line_unit(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList, double[] Target_Pos, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_arc_move_center_unit(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList, double[] Target_Pos, double[] Cen_Pos, ushort Arc_Dir, int Circle, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_arc_move_radius_unit(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList, double[] Target_Pos, double Arc_Radius, ushort Arc_Dir, int Circle, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_arc_move_3points_unit(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList, double[] Target_Pos, double[] Mid_Pos, int Circle, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_read_current_speed_unit(ushort CardNo, ushort Axis, ref double current_speed);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_vector_profile_unit(ushort CardNo, ushort Crd, double Min_Vel, double Max_Vel, double Tacc, double Tdec, double Stop_Vel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_vector_profile_unit(ushort CardNo, ushort Crd, ref double Min_Vel, ref double Max_Vel, ref double Tacc, ref double Tdec, ref double Stop_Vel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_profile_unit(ushort CardNo, ushort Axis, double Min_Vel, double Max_Vel, double Tacc, double Tdec, double Stop_Vel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_profile_unit(ushort CardNo, ushort Axis, ref double Min_Vel, ref double Max_Vel, ref double Tacc, ref double Tdec, ref double Stop_Vel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_reset_target_position_unit(ushort CardNo, ushort Axis, double New_Pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_update_target_position_unit(ushort CardNo, ushort Axis, double New_Pos);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_change_speed_unit(ushort CardNo, ushort Axis, double New_Vel, double Taccdec);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_open_list(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_close_list(ushort CardNo, ushort Crd);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_stop_list(ushort CardNo, ushort Crd, ushort stop_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_pause_list(ushort CardNo, ushort Crd);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_start_list(ushort CardNo, ushort Crd);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int dmc_conti_remain_space(ushort CardNo, ushort Crd);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int dmc_conti_read_current_mark(ushort CardNo, ushort Crd);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_blend(ushort CardNo, ushort Crd, ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_get_blend(ushort CardNo, ushort Crd, ref ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_lookahead_end_vel_zero(ushort CardNo, ushort Crd, ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_profile_unit(ushort CardNo, ushort Crd, double Min_Vel, double Max_vel, double Tacc, double Tdec, double Stop_Vel);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_s_profile(ushort CardNo, ushort Crd, ushort s_mode, double s_para);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_get_s_profile(ushort CardNo, ushort Crd, ushort s_mode, ref double s_para);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_pause_output(ushort CardNo, ushort Crd, ushort action, int mask, int state);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_get_pause_output(ushort CardNo, ushort Crd, ref ushort action, ref int mask, ref int state);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_override(ushort CardNo, ushort Crd, double Percent);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_change_speed_ratio(ushort CardNo, ushort Crd, double Percent);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_get_run_state(ushort CardNo, ushort Crd);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_check_done(ushort CardNo, ushort Crd);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_wait_input(ushort CardNo, ushort Crd, ushort bitno, ushort on_off, double TimeOut, int mark);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_delay_outbit_to_start(ushort CardNo, ushort Crd, ushort bitno, ushort on_off, double delay_value, ushort delay_mode, double ReverseTime);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_delay_outbit_to_stop(ushort CardNo, ushort Crd, ushort bitno, ushort on_off, double delay_time, double ReverseTime);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_ahead_outbit_to_stop(ushort CardNo, ushort Crd, ushort bitno, ushort on_off, double ahead_value, ushort ahead_mode, double ReverseTime);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_accurate_outbit_unit(ushort CardNo, ushort Crd, ushort cmp_no, ushort on_off, ushort map_axis, double abs_pos, ushort pos_source, double ReverseTime);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_write_outbit(ushort CardNo, ushort Crd, ushort bitno, ushort on_off, double ReverseTime);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_delay(ushort CardNo, ushort Crd, double delay_time, int mark);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_pmove_unit(ushort CardNo, ushort Crd, ushort Axis, double dist, ushort posi_mode, ushort mode, int mark);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_line_unit(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList, double[] Target_Pos, ushort posi_mode, int mark);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_arc_move_center_unit(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList, double[] Target_Pos, double[] Cen_Pos, ushort Arc_Dir, int Circle, ushort posi_mode, int mark);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_arc_move_radius_unit(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList, double[] Target_Pos, double Arc_Radius, ushort Arc_Dir, int Circle, ushort posi_mode, int mark);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_arc_move_3points_unit(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList, double[] Target_Pos, double[] Mid_Pos, int Circle, ushort posi_mode, int mark);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_clear_io_action(ushort CardNo, ushort Crd, uint IoMask);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_stop_reason(ushort CardNo, ushort axis, ref int StopReason);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_clear_stop_reason(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_involute_mode(ushort CardNo, ushort Crd, ushort mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_get_involute_mode(ushort CardNo, ushort Crd, ref ushort mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_rectangle_move_unit(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList, double[] TargetPos, double[] MaskPos, int Count, ushort rect_mode, ushort posi_mode, int mark);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_calculate_arclength_center(double[] start_pos, double[] target_pos, double[] cen_pos, ushort arc_dir, double circle, ref double ArcLength);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_calculate_arclength_3point(double[] start_pos, double[] mid_pos, double[] target_pos, double circle, ref double ArcLength);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_calculate_arclength_radius(double[] start_pos, double[] target_pos, double arc_radius, ushort arc_dir, double circle, ref double ArcLength);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_rectangle_move_unit(ushort CardNo, ushort Crd, ushort AxisNum, ushort[] AxisList, double[] TargetPos, double[] MaskPos, int Count, ushort rect_mode, ushort posi_mode);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_da_enable(ushort CardNo, ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_da_enable(ushort CardNo, ref ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_da_output(ushort CardNo, ushort channel, double Vout);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_da_output(ushort CardNo, ushort channel, ref double Vout);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_da_enable(ushort CardNo, ushort Crd, ushort enable, ushort channel, int mark);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_encoder_da_follow_enable(ushort CardNo, ushort axis, ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_encoder_da_follow_enable(ushort CardNo, ushort axis, ref ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_da_follow_speed(ushort CardNo, ushort Crd, ushort da_no, double MaxVel, double MaxValue, double acc_offset, double dec_offset, double acc_dist, double dec_dist);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_get_da_follow_speed(ushort CardNo, ushort Crd, ushort da_no, ref double MaxVel, ref double MaxValue, ref double acc_offset, ref double dec_offset, ref double acc_dist, ref double dec_dist);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_ad_input(ushort CardNo, ushort channel, ref double Vout);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_vector_s_profile(ushort CardNo, ushort Crd, ushort s_mode, double s_para);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_vector_s_profile(ushort CardNo, ushort Crd, ushort s_mode, ref double s_para);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_lookahead_mode(ushort CardNo, ushort Crd, ushort enable, int LookaheadSegments, double PathError, double LookaheadAcc);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_get_lookahead_mode(ushort CardNo, ushort Crd, ref ushort enable, ref int LookaheadSegments, ref double PathError, ref double LookaheadAcc);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_pwm_enable(ushort CardNo, ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_pwm_enable(ushort CardNo, ref ushort enable);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_pwm_output(ushort CardNo, ushort pwm_no, double fDuty, double fFre);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_pwm_output(ushort CardNo, ushort pwm_no, ref double fDuty, ref double fFre);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_pwm_onoff_duty(ushort CardNo, ushort PwmNo, double fOnDuty, double fOffDuty);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_pwm_onoff_duty(ushort CardNo, ushort PwmNo, ref double fOnDuty, ref double fOffDuty);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_pwm_output(ushort CardNo, ushort Crd, ushort pwm_no, double fDuty, double fFre);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_set_pwm_follow_speed(ushort CardNo, ushort Crd, ushort pwm_no, ushort mode, double MaxVel, double MaxValue, double OutValue);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_get_pwm_follow_speed(ushort CardNo, ushort Crd, ushort pwm_no, ref ushort mode, ref double MaxVel, ref double MaxValue, ref double OutValue);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_delay_pwm_to_start(ushort CardNo, ushort Crd, ushort pwmno, ushort on_off, double delay_value, ushort delay_mode, double ReverseTime);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_ahead_pwm_to_stop(ushort CardNo, ushort Crd, ushort pwmno, ushort on_off, double ahead_value, ushort ahead_mode, double ReverseTime);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_conti_write_pwm(ushort CardNo, ushort Crd, ushort pwmno, ushort on_off, double ReverseTime);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_set_arc_limit(ushort CardNo, ushort Crd, ushort Enable, double MaxCenAcc, double MaxArcError);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_get_arc_limit(ushort CardNo, ushort Crd, ref ushort Enable, ref double MaxCenAcc, ref double MaxArcError);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_trace_start(ushort CardNo, ushort AxisNum, ushort[] AxisList);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_trace_stop(ushort CardNo);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_download_file(ushort CardNo, string pfilename, byte[] pfilenameinControl, ushort filetype);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_download_memfile(ushort CardNo, byte[] pbuffer, uint buffsize, byte[] pfilenameinControl, ushort filetype);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_upload_file(ushort CardNo, string pfilename, byte[] pfilenameinControl, ushort filetype);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short dmc_upload_memfile(ushort CardNo, byte[] pbuffer, uint buffsize, byte[] pfilenameinControl, ref uint puifilesize, ushort filetype);

        [DllImport("LTDMC.dll")]
        public static extern short dmc_get_progress(ushort CardNo, ref float process);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_download_configfile(ushort CardNo, ushort PortNum, string FileName);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_download_mapfile(ushort CardNo, string FileName);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_set_manager_para(ushort CardNo, ushort PortNum, int baudrate, ushort ManagerID);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_get_manager_para(ushort CardNo, ushort PortNum, ref uint baudrate, ref ushort ManagerID);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_set_manager_od(ushort CardNo, ushort PortNum, ushort index, ushort subindex, ushort valuelength, uint value);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_get_manager_od(ushort CardNo, ushort PortNum, ushort index, ushort subindex, ushort valuelength, ref uint value);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_get_total_axes(ushort CardNo, ref uint TotalAxis);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_get_total_ionum(ushort CardNo, ref ushort TotalIn, ref ushort TotalOut);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_get_LostHeartbeat_Nodes(ushort CardNo, ushort PortNum, ushort[] NodeID, ref ushort NodeNum);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_get_EmergeneyMessege_Nodes(ushort CardNo, ushort PortNum, uint[] NodeMsg, ref ushort MsgNum);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_SendNmtCommand(ushort CardNo, ushort PortNum, ushort NodeID, ushort NmtCommand);

        [DllImport("LTDMC.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern short nmc_syn_move(ushort CardNo, ushort AxisNum, ushort[] AxisList, int[] Position, ushort[] PosiMode);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_total_adcnum(ushort CardNo, ref ushort TotalIn, ref ushort TotalOut);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_controller_workmode(ushort CardNo, ushort controller_mode);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_controller_workmode(ushort CardNo, ref ushort controller_mode);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_cycletime(ushort CardNo, ushort FieldbusType, int CycleTime);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_cycletime(ushort CardNo, ushort FieldbusType, ref int CycleTime);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_node_od(ushort CardNo, ushort PortNum, ushort nodenum, ushort index, ushort subindex, ushort valuelength, ref int value);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_node_od(ushort CardNo, ushort PortNum, ushort nodenum, ushort index, ushort subindex, ushort valuelength, int value);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_reset_to_factory(ushort CardNo, ushort PortNum, ushort NodeNum);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_alarm_clear(ushort CardNo, ushort PortNum, ushort nodenum);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_write_outbit(ushort CardNo, ushort NodeID, ushort IoBit, ushort IoValue);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_read_outbit(ushort CardNo, ushort NodeID, ushort IoBit, ref ushort IoValue);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_read_inbit(ushort CardNo, ushort NodeID, ushort IoBit, ref ushort IoValue);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_write_outport(ushort CardNo, ushort NodeID, ushort PortNo, int IoValue);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_read_outport(ushort CardNo, ushort NodeID, ushort PortNo, ref int IoValue);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_read_inport(ushort CardNo, ushort NodeID, ushort PortNo, ref int IoValue);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_axis_state_machine(ushort CardNo, ushort axis, ref ushort Axis_StateMachine);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_axis_statusword(ushort CardNo, ushort axis, ref int statusword);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_axis_setting_contrlmode(ushort CardNo, ushort axis, ref int contrlmode);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_axis_contrlword(ushort CardNo, ushort axis, ref int contrlword);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_axis_type(ushort CardNo, ushort axis, ref ushort Axis_Type);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_consume_time_fieldbus(ushort CardNo, ushort Fieldbustype, ref uint Average_time, ref uint Max_time, ref ulong Cycles);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_clear_consume_time_fieldbus(ushort CardNo, ushort Fieldbustype);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_axis_enable(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_axis_disable(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_axis_node_address(ushort CardNo, ushort axis, ref ushort SlaveAddr, ref ushort Sub_SlaveAddr);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_total_slaves(ushort CardNo, ushort PortNum, ref ushort TotalSlaves);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_home_profile(ushort CardNo, ushort axis, ushort home_mode, double Low_Vel, double High_Vel, double Tacc, double Tdec, double offsetpos);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_home_profile(ushort CardNo, ushort axis, ref ushort home_mode, ref double Low_Vel, ref double High_Vel, ref double Tacc, ref double Tdec, ref double offsetpos);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_home_move(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_start_scan_ethercat(ushort CardNo, ushort AddressID);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_stop_scan_ethercat(ushort CardNo, ushort AddressID);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_axis_run_mode(ushort CardNo, ushort axis, ushort run_mode);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_clear_alarm_fieldbus(ushort CardNo, ushort PortNum);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_stop_etc(ushort CardNo, ref ushort ETCState);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_axis_contrlmode(ushort CardNo, ushort Axis, ref int Contrlmode);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_errcode(ushort CardNo, ushort channel, ref ushort errcode);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_clear_errcode(ushort CardNo, ushort channel);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_axis_errcode(ushort CardNo, ushort axis, ref ushort Errcode);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_clear_axis_errcode(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_write_rxpdo_extra(ushort ConnectNo, ushort PortNum, ushort address, ushort DataLen, uint Value);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_read_rxpdo_extra(ushort ConnectNo, ushort PortNum, ushort address, ushort DataLen, ref uint Value);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_read_txpdo_extra(ushort ConnectNo, ushort PortNum, ushort address, ushort DataLen, ref uint Value);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_set_axis_io_out(ushort CardNo, ushort axis, uint iostate);

        [DllImport("LTDMC.dll")]
        public static extern uint nmc_get_axis_io_out(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll")]
        public static extern uint nmc_get_axis_io_in(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_start_connect(ushort CardNo, ushort chan, ushort[] info, ref ushort nodenum);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_vendor_info(ushort CardNo, ushort axis, byte[] info, ref ushort len);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_slave_type_info(ushort CardNo, ushort axis, byte[] info, ref ushort len);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_slave_name_info(ushort CardNo, ushort axis, byte[] info, ref ushort len);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_get_slave_version_info(ushort CardNo, ushort axis, byte[] info, ref ushort len);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_write_parameter(ushort CardNo, ushort axis, ushort index, ushort subindex, uint para_data);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_read_parameter(ushort CardNo, ushort axis, ushort index, ushort subindex, ref uint para_data);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_read_parameter_attributes(ushort CardNo, ushort axis, ushort index, ushort subindex, ref uint para_data);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_write_slave_eeprom(ushort CardNo, ushort axis);

        [DllImport("LTDMC.dll")]
        public static extern short nmc_driver_reset(ushort CardNo, ushort axis);


        /// <summary>
        /// 点位模式运动参数
        /// </summary>
        public struct DmMovePrm
        {
            public double Min_Vel;// 加速度，单位“脉冲/毫秒2”
            public double Max_Vel;// 减速度，单位“脉冲/毫秒2”
            public double Tacc;// 起跳速度，单位“脉冲/毫秒”
    
            public double Tdec;// 起跳速度，单位““脉冲/毫秒””
            public double Stop_vel;// 起跳速度，单位“毫秒”
        }



    }







}